package com.wicket.okrapp.biz.service.impl;

import com.wicket.okrapp.biz.service.dto.req.*;
import com.wicket.okrapp.biz.service.dto.res.*;
import com.wicket.okrapp.common.util.CommonFunctionHelper;
import com.wicket.okrapp.common.util.RedisUtil;

import javax.annotation.Resource;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wicket.okrapp.base.service.MOmsExecuteCycleStageService;
import com.wicket.okrframework.integration.dto.QuerySpaceDetailComRespDto;
import com.wicket.okrframework.integration.dto.QuerySpaceDetailComReqDto;
import com.wicket.okrframework.integration.dto.QueryDeptDetailComBorderRespDto;
import com.wicket.okrframework.integration.dto.QueryDeptDetailComBorderReqDto;
import com.wicket.okrapp.common.exception.Assert;
import com.wicket.okrapp.biz.service.nb.NbCrossTempIntegrate;
import com.wicket.okrframework.integration.FwBaseBaseClient;
import com.wicket.okrframework.integration.FwBaseOrgClient;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class CrossTempIntegrateServiceImpl
  implements com.wicket.okrapp.biz.service.CrossTempIntegrateService {

  @Resource
  private RedisUtil redisUtil;
@Resource
  private MOmsExecuteCycleStageService mOmsExecuteCycleStageService;
@Resource
  private NbCrossTempIntegrate nbCrossTempIntegrate;
@Resource
  private FwBaseBaseClient fwBaseBaseClient;
@Resource
  private FwBaseOrgClient fwBaseOrgClient;
/**
   * D3分析整合主题内容信息(公共)[10133]
   * gen by moon at 8/21/2024, 12:16:05 PM
   */
  @Trace(operationName = "D3分析整合主题内容信息(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public AnalysisIntegrateThemeContInfoComRespDto analysisIntegrateThemeContInfoCom(AnalysisIntegrateThemeContInfoComReqDto reqDto){
    
      
      ImplementElevenReceivingFieldRespDto receptionServiceRes_1 =null;
if((reqDto!= null&&  reqDto.getIntegrateThemeContType() !=null && reqDto.getIntegrateThemeContType().equals("OMS_ORG_ORGANIZATION"))) {
        //if(D3分析整合主题内容信息(公共).整合主题内容类型编码 等于 组织表)  72396
        
QuerySpaceDetailComRespDto querySpaceDetailComRespDto = null;
    QuerySpaceDetailComReqDto querySpaceDetailComReqDto=new QuerySpaceDetailComReqDto();

    querySpaceDetailComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//SimpleFieldAssign//sourceId:1980290_1_72398

  
    /*D1-2查空间详情(公共)[402]   */
    Assert.isNull(querySpaceDetailComReqDto.getSpaceId(),"D3分析整合主题内容信息(公共)-D1-2查空间详情(公共)-空间ID不能为空",false);
      querySpaceDetailComRespDto = fwBaseBaseClient.querySpaceDetailCom(querySpaceDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      
//ModelCode: receptionService
        ImplementElevenReceivingFieldRespDto receptionServiceRes = null;
    if(querySpaceDetailComRespDto !=null){
          ImplementElevenReceivingFieldReqDto receptionServiceReq=new ImplementElevenReceivingFieldReqDto();
  if(querySpaceDetailComRespDto!=null){
      receptionServiceReq.setIntegrateThemeContName(querySpaceDetailComRespDto.getAbbreviation());//SimpleFieldAssign//sourceId:1980756_1_72400
    }
  
    /*M3接收整合主题内容名称出参[9482]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq.getIntegrateThemeContName(),"D3分析整合主题内容信息(公共)-M3接收整合主题内容名称出参-整合主题内容名称不能为空",false);
      receptionServiceRes = nbCrossTempIntegrate.implementElevenReceivingField(receptionServiceReq);
      
      
      receptionServiceRes_1 = receptionServiceRes;
           }
      }
else if((reqDto!= null&&  reqDto.getIntegrateThemeContType() !=null && reqDto.getIntegrateThemeContType().equals("OMS_ORG_DEPT"))){
       //elseif(D3分析整合主题内容信息(公共).整合主题内容类型编码 等于 部门表)  72397
      
QueryDeptDetailComBorderRespDto queryDeptDetailComBorderRespDto = null;
    QueryDeptDetailComBorderReqDto queryDeptDetailComBorderReqDto=new QueryDeptDetailComBorderReqDto();
  if(reqDto!=null){
      queryDeptDetailComBorderReqDto.setDeptId(reqDto.getIntegrateThemeContId());//SimpleFieldAssign//sourceId:1980316_1_72399
    }
  
    /*D1-3查询部门详情(公共)(边界)[2691]   */
    Assert.isNull(queryDeptDetailComBorderReqDto.getDeptId(),"D3分析整合主题内容信息(公共)-D1-3查询部门详情(公共)(边界)-部门ID不能为空",false);
      queryDeptDetailComBorderRespDto = fwBaseOrgClient.queryDeptDetailComBorder(queryDeptDetailComBorderReqDto).getData()/*vcase invoke 跨dubbo调用;*/;
      
      
      
//ModelCode: receptionService
        ImplementElevenReceivingFieldRespDto receptionServiceRes_2 = null;
    if(queryDeptDetailComBorderRespDto !=null){
          ImplementElevenReceivingFieldReqDto receptionServiceReq_1=new ImplementElevenReceivingFieldReqDto();
  if(queryDeptDetailComBorderRespDto!=null){
      receptionServiceReq_1.setIntegrateThemeContName(queryDeptDetailComBorderRespDto.getDeptShortName());//SimpleFieldAssign//sourceId:1980756_1_72401
    }
  
    /*M3接收整合主题内容名称出参[9482]  用于特殊方法接收上游入参。 */
    Assert.isNull(receptionServiceReq_1.getIntegrateThemeContName(),"D3分析整合主题内容信息(公共)-M3接收整合主题内容名称出参-整合主题内容名称不能为空",false);
      receptionServiceRes_2 = nbCrossTempIntegrate.implementElevenReceivingField(receptionServiceReq_1);
      
      
      receptionServiceRes_1 = receptionServiceRes_2;
           }
    }
AnalysisIntegrateThemeContInfoComRespDto retData = new AnalysisIntegrateThemeContInfoComRespDto();
  if(receptionServiceRes_1!=null){
      retData.setIntegrateThemeContName(receptionServiceRes_1.getIntegrateThemeContName());//SimpleFieldAssign//sourceId:1980758_1
    }
  

  
  
return retData;
  }
  //
}
